<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('分析训练集是否合格')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content" id="main">

</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<script th:src="@{/js/echarts.min.js}"></script>
<script th:src="@{/js/stock_fasttext_train.js}"></script>
<script th:inline="javascript">

    var f1 = [[${type}]];

    var prefix1 = ctx + "stock2/TRAIN";
    $.ajax({
        url : prefix1 + '/listByType',
        type : 'post',
        dataType : 'json',
        cache : false,
        data : {
            type : f1
        },
        success : function(result) {
            var list = result.rows;
            for(j = 0,len=list.length; j < len; j++) {
                var div_id = "div_" + list[j].symbol + "_"+ list[j].datetime;
                var tabimg_id = "tabimg_" + list[j].symbol + "_"+ list[j].datetime;
                var new_row = "<div class=\"row\">"+
                    "	<div class=\"col-sm-12\">"+
                    "		<div class=\"ibox float-e-margins\">"+
                    "			<div class=\"ibox-title\">"+
                    "				<h5>达到要求 </h5><a  href=\"javascript:void(0)\" onclick=\"remove("+list[j].id+")\"> 删除</a>"+
                    "				<div class=\"pull-right\">"+
                    "<h5>达到要求 </h5><a  href=\"javascript:void(0)\" onclick=\"remove("+list[j+1].id+")\"> 删除</a>"+
                    "				</div>"+
                    "			</div>"+
                    "			<div class=\"ibox-content\">"+
                    "				<div class=\"row\">"+
                    "					<div class=\"col-sm-6\">"+
                    "<div id='"+div_id+"' style='width:800px;height:400px;'></div>"+
                    "					</div>"+
                    "					<div class=\"col-sm-6\">"+
                    "<div id='"+tabimg_id+"' style='width:800px;height:400px;'></div>"+
                    "					</div>"+
                    "				</div>"+
                    "			</div>"+
                    "		</div>"+
                    "	</div>"+
                    "</div>";

                $("#main").append(new_row);
                foretellGetFun(list[j].symbol, div_id, list[j].datetime);
                foretellGetFun(list[j+1].symbol, tabimg_id, list[j+1].datetime);
                j++;

            }

        },
        error : function(XMLHttpRequest, textStatus, errorThrown) {
            alert("error");
        }
    })



    function submitHandler() {
        $.modal.close();
    }

    function remove(id) {
        $.ajax({
            url : '/stock2/TRAIN/remove',
            type : 'get',
            dataType : 'json',
            cache : false,
            data : {
                id : id
            },
            success : function(result) {
                alert(result.msg);
            },
            error : function(XMLHttpRequest, textStatus, errorThrown) {
                alert("error");
            }
        })
    }

</script>
</body>
</html>